;loop
;(define loop (lambda (n f) arg (if (> n 0) (begin (f arg) (loop (- n 1) f)) '())))

;(define interaction-environment environment)
(define loop (lambda (n f) (if (> n 0) (begin (eval f (interaction-environment)) (loop (- n 1) f)) '())))

;stack
(define stack? (lambda (x) (list? x)))
(define stack-new (lambda () '(())))
(define stack-empty? (lambda (x) (if (null? x) #f (if (and (null? (car x)) (null? (cdr x))) #t #f ))))
(define stack-pop! (lambda (x) (if (stack-empty? x) '() (let ((e (cdr x)) (v (car x))) (if (null? e) (begin (set-car! x '()) v) (if (null? (cdr e)) (begin (set-cdr! x '()) (car e)) (stack-pop! (cdr x)) )))))) 
(define stack-push! (lambda (x y) (if (stack-empty? x) (set-car! x y) (if (null? (cdr x)) (set-cdr! x (cons y '())) (stack-push! (cdr x) y)))))







function queen(field,y,rel){
  if(y == field ){
	return true;
  }
  for(var i =0;i< field;++i){
  var p = 0;
	for(var n in rel){
	  if(rel[n][0] == i||rel[n][1] == y||Math.abs(rel[n][1] - y) == Math.abs(rel[n][0] - i)){
		p = 1;
		break;
	  }
	}
	if(p==1){continue;}
	  rel.push([i,y]);
	  if(!queen(field,y+1,rel)){
		rel.pop();
		continue;
	  }
	  return true;
  }
  return false;
}

(define r (stack-new))
(define 8queen (lambda (f,y,r) (if (= f y) #t (if (null? (filter )) ) )))
